package com.gxar.quick.ar.server.base.common.enums.protocol;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * AR内容加载场景
 *
 * @author zxh
 * @version 1.0
 * @created 2024/01/02.
 */
@Getter
public enum ArLoadSceneEnum {

    DEFAULT("", "默认场景"),
    SCAN("scan", "扫图识别"),
    PLANE("plane", "平面投放"),
    HAND("hand", "手掌投放"),
    SPACE_FIXED("space_fixed", "空间固定"),
    PREVIEW("preview", "作品预览")
    ;

    private final String name;
    private final String desc;

    ArLoadSceneEnum(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static ArLoadSceneEnum getByName(String name) {
        Optional<ArLoadSceneEnum> targetEnum = Arrays.stream(ArLoadSceneEnum.values()).filter(e -> e.getName().equals(name)).findFirst();
        return targetEnum.orElse(DEFAULT);
    }
}
